﻿using System;
using System.Collections;

namespace TCL.FUNC
{
    public class GetListConstantsEx
    {
        public static String FindKey_ByValue(SortedList slTemp, Object Value, String DefaultValue = "")
        {
            String Key = DefaultValue;
            if (slTemp.ContainsValue(Value))
            {
                Key = Convert.ToString(slTemp.GetKey(slTemp.IndexOfValue(Value)));
            }
            return Key;
        }

        public static String FindValue_ByKey(SortedList slTemp, Object Key, String DefaultValue = "")
        {
            String Value = DefaultValue;
            if (slTemp.ContainsKey(Key))
            {
                Value = Convert.ToString(slTemp.GetByIndex(slTemp.IndexOfKey(Key)));
            }
            return Value;
        }

        public static SortedList ListDefaul()
        {
            SortedList sl = new SortedList();
            sl.Add("0", "0");
            sl.Add("1", "1");
            return sl;
        }

        public static SortedList Constant_iType()
        {
            SortedList sl = new SortedList();
            sl.Add("0", "0");
            sl.Add("1", "Http Content Type");
            sl.Add("2", "2");
            return sl;
        }
    }
}
